//
//  SuperViewController.m
//  location
//
//  Created by Dongxiang Xu on 2024/5/10.
//

#import "SuperViewController.h"

@interface SuperViewController ()

@end

@implementation SuperViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:@selector(pop)];
    self.navigationItem.backBarButtonItem = item;
    
    self.navigationItem.hidesBackButton = YES;
    
    self.view.backgroundColor = RealWhiteColor;
}

- (void)pop
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)getVersion
{
    if ([XDXShareInstance shareInstance].userId.integerValue==110) {
        NSMutableDictionary *param = [NSMutableDictionary dictionary];
        [param setValue:@"iOS_version" forKey:@"key"];
        CryptoHTTPKit *manager = [[CryptoHTTPKit alloc] init];
        [manager encryptedPOST:@"/apps/data/config/get"
                    parameters:param
                       success:^(NSDictionary *responseObject) {
            if ([responseObject[@"code"] integerValue]==200 && [responseObject[@"data"] isKindOfClass:[NSString class]]) {
                NSData *data = [responseObject[@"data"] dataUsingEncoding:NSUTF8StringEncoding];
                if (data) {
                    NSArray *array = [NSJSONSerialization JSONObjectWithData:data
                                                                     options:0
                                                                       error:nil];
                    if (array.count>0) {
                        NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
                        BOOL applePay = YES;
                        for (NSString *version in array) {
                            if ([currentVersion isEqualToString:version]) {
                                applePay = NO;
                                break;
                            }
                        }
                        [XDXShareInstance shareInstance].applePay = applePay;
                    }
                }
                
            }
        }
        failure:^(NSError *aError) {
            
        }];
    }
}
@end
